//
//  ZLAlert.h
//  ZLAlert
//
//  Created by  Jiaozl on 2017/3/31.
//  Copyright © 2017年  Jiaozl. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "UIAlertController+AddAction.h"

@interface ZLAlert : NSObject

typedef void (^AlertConfirmHandle)(void);
typedef void (^AlertCancelHandle)(void);
typedef void (^AlertDestructiveHandle)(void);

typedef void (^AlertMarker)(UIAlertController *maker);
/**
 Quick to show a simple Alert only with confirm and cancel
 when confirmTitle or cancelTitle equel nil, only show one action
 
 @param title - Alert's title
 @param message - any message you want to show
 @param cancelTitle - the title of cancel button (UIAlertActionStyleCancel)
 @param cancleHandle - cancel opeartion
 */
+ (void)showSimpleAlertWithTitle:(NSString *)title
                   message:(NSString *)message
               cancleTitle:(NSString *)cancelTitle
              cancleHandle:(AlertCancelHandle)cancleHandle;

/**
 Quick to show Alert only with confirm and cancel
 when confirmTitle or cancelTitle equel nil, only show one action

 @param title - Alert's title
 @param message - any message you want to show
 @param confirmTitle - the title of confirm button (UIAlertActionStyleDefault)
 @param cancelTitle - the title of cancel button (UIAlertActionStyleCancel)
 @param preferredStyle -   UIAlertControllerStyle
 @param confirmHandle - confirm opeartion
 @param cancleHandle - cancel opeartion
 */
+ (void)showAlertWithTitle:(NSString *)title
                   message:(NSString *)message
              confirmTitle:(NSString *)confirmTitle
               cancelTitle:(NSString *)cancelTitle
            preferredStyle:(UIAlertControllerStyle)preferredStyle
             confirmHandle:(AlertConfirmHandle)confirmHandle
              cancleHandle:(AlertCancelHandle)cancleHandle;


/**
 Quick to show Alert from  three type of UIAlertActionStyle
 You can omit any one
 
 @param title - Alert's title
 @param message - any message you want to show
 @param confirmTitle - the title of confirm button (UIAlertActionStyleDefault)
 @param cancelTitle - the title of cancel button (UIAlertActionStyleCancel)
 @param preferredStyle -   UIAlertControllerStyle
 @param confirmHandle - confirm opeartion
 @param cancleHandle - cancel opeartion
 */

+ (void)showAlertWithTitle:(NSString *)title
                   message:(NSString *)message
              confirmTitle:(NSString *)confirmTitle
               cancelTitle:(NSString *)cancelTitle
         otherConfirmTitle:(NSString *)otherConfirmTitle
            preferredStyle:(UIAlertControllerStyle)preferredStyle
             confirmHandle:(AlertConfirmHandle)confirmHandle
              cancleHandle:(AlertCancelHandle)cancleHandle
        otherConfirmHandle:(AlertDestructiveHandle)otherConfirmHandle;


/**
 Custom Alert built

 @param title - Alert's title
 @param message - any message you want to show
 @param preferredStyle -   UIAlertControllerStyle
 @param actionMaker - to add UIAlertAction by actionMaker
 */
+ (void)showAlertWithTitle:(NSString *)title
                   message:(NSString *)message
            preferredStyle:(UIAlertControllerStyle)preferredStyle
               actionMaker:(AlertMarker)actionMaker;
/**
 Only show Alert Message and auto dismiss

 @param title - Alert's title
 @param message - any message you want to show
 @param preferredStyle - show style (ActionSheet / Alert)
 @param autoDismissTime alert will auto dismiss after autoDismissTime
 */
+ (void)showAlertWithTitle:(NSString *)title
                   message:(NSString *)message
            preferredStyle:(UIAlertControllerStyle)preferredStyle
           autoDismissTime:(int)autoDismissTime;


/**
 Custom Alert built with Titles

 @param title - Alert's title
 @param msg - any message you want to show
 @param alertCStyle -   UIAlertControllerStyle
 @param cancelTitle - the title of cancel button (UIAlertActionStyleCancel)
 @param titles - the title of each action button
 @param completeHandler - operations
 @param cancelHandler  - cancel operation
 */
+ (void)showAlertWithTitle:(NSString *)title
                   message:(NSString *)msg
            preferredStyle:(UIAlertControllerStyle)alertCStyle
               cancelTitle:(NSString *)cancelTitle
              actionTitles:(NSArray *)titles
           completeHandler:(void(^)(NSInteger index, NSString *title))completeHandler
             cancelHandler:(void(^)(void))cancelHandler;


@end
